<?php
declare (strict_types = 1);

namespace app\controller;

use app\BaseController;
use app\model\Account;
use think\Exception;
use think\Request;

class App extends BaseController
{
   public function secret(){
       try{
           $params=$this->request->param();

           $app_id=$params['app_id'];

           $secret=$params['secret'];

           (new Account())->setSecret($app_id,$secret);
          return $this->apiJson(0,'','设置成功,保存成功');
           //保存secret作为校验密钥
       }catch (Exception $exception){
           return $this->apiJson(1,'',$exception->getMessage());
       }
   }

   public function ip(){
       try{
           $params=$this->request->param();

           $app_id=$params['app_id'];

           $ip=$params['ip'];
           (new Account())->setIp($app_id,$ip);

          return $this->apiJson(0,'','ip设置成功');
           //保存secret作为校验密钥
       }catch (Exception $exception){
          return $this->apiJson(1,'',$exception->getMessage());
       }
   }
}
